#include <bits/stdc++.h>

using namespace std;

const int NUM = 3;
bool flag[NUM+1];
vector<int> res;
void print(vector<int> res){
    for(int i=0;i<NUM;i++) cout<<res[i];
    cout<<endl;
}
void dfs(int depth){
    if(depth == NUM) {
        print(res);
        return;
    }
    for (int i = 1; i <= NUM; ++i) {
        if(!flag[i]) {
            flag[i] = true;
            res.push_back(i);
            dfs(depth+1);
            res.pop_back();
            flag[i] = false;
        }
    }
}

int main() {
    dfs(0);
}
